package com.pj.ca.common;

/**
 * 描述：
 *
 * @author pengjun
 * @date 2021/11/3 16:32
 */
public class ReturnResultBuilder<T> {

    //简单结果生成

    /**成功
     * @param info
     * @return
     */
    public static <T> ReturnResult<T> buildOkResult(T info){
        ReturnResult<T> res = new ReturnResult<T>();
        res.setInfo(info);
        res.setStatus(ReturnResultCode.OK.code);
        return res;
    }
    /**成功
     * @return
     */
    public static ReturnResult buildOkResult(String msg){
        ReturnResult res = new ReturnResult();
        res.setStatus(ReturnResultCode.OK.code);
        res.setMsg(msg);
        return res;
    }
    /**失败
     * @param code
     * @param msg
     * @return
     */
    public static ReturnResult buildFailResult(Integer code, String msg){
        ReturnResult res = new ReturnResult();
        res.setCode(code);
        res.setStatus(ReturnResultCode.FAIL.code);
        res.setMsg(msg);
        return res;
    }



}

